package com.atguigu.mybaits_plus_test.service.impl;

import com.atguigu.mybaits_plus_test.mapper.UserMapper;
import com.atguigu.mybaits_plus_test.pojo.User;
import com.atguigu.mybaits_plus_test.service.UserService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author chenyj
 * @date 2022/10/24
 */
@Service
public class UserServiceImpl implements UserService {

    private final static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    UserMapper userMapper;

    @Override
    public int insert(User entity) {
        return 0;
    }

    @Override
    public int deleteById(Serializable id) {
        return 0;
    }

    @Override
    public int updateById(User entity) {
        return 0;
    }

    @Override
    public User selectById(Serializable id) {
        logger.info("查找的id为" + id);
        if(Objects.isNull(id)){
            logger.warn("用户id不能为空");
            return null;
        }
        return userMapper.selectById(id);
    }

    @Override
    public Integer selectCount(Wrapper<User> queryWrapper) {
        return null;
    }
}
